<template>
	<view>
		<view class="content">
			<image :class="className" @click="clickImage" src="/static/logo.png"></image>
			<view class="text-area">
				<text class="title">{{title}}</text>
			</view>
			<button class="mini-btn" @tap="ChangeImageSize()">点击变大变高</button>
		</view>

		<view class="content" style="margin-top: 10px;">
			<view>{{Text1}}</view>
			<view>{{number + 1}}</view>
			<view>{{ok ? 'ture' : 'false'}}</view>
		</view>
		
		<view class="content">
			<view v-if="!raining">今天天不错</view>
			<view v-if="raining">今天下雨</view>
			<view v-if="state==='Vue'">state的值为 Vue</view>
			<view>
				<view v-if="state==='Vue'">uni-app</view>
				<view v-else-if="state==='html'">HTML</view>
				<view v-else>APP</view>
			</view>
		</view>
			
		<view class="content">
			<view v-for="item in arr" style="color: red;">{{item}}</view>
			<view v-for="(item,index) in 4" style="color: aquamarine;">
				<view :class="'list-'+index%2">{{index%2}}</view>
			</view>
			<view v-for="(value,name,index) in object">
				{{index}}.{{name}}:{{value}}
			</view>
			<view v-for="item in arr" :key="item.id">
				<view style="color: blue;">{{item.id}}:{{item.name}}</view>
			</view>
		</view>
			
		<view class="content">
			<view class="flex-item" :style="col" @click="changeColor"></view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				title: '标题1',
				Text1: '测试文本1',
				number: 4399,
				ok: true,
				className:"smallLoge",
				raining: false,
				state:'Vue',
				col:"background-color: red;",
				arr:[
					{id:1,name:'uni-app'},
					{id:2,name:'html'}
				],
				object:{
					title:'123',
					author:'456',
					tiem:'1900-0-0'
				},
				colorArr:[
					"background-color: red;",
					"background-color: orange;",
					"background-color: yellow;",
					"background-color: green;",
					"background-color: cyan;",
					"background-color: blue;",
					"background-color: purple;"
				],
				num: 0
			}
		},
		methods: {
			ChangeImageSize() {
				this.className='logo';
				this.title='请输入文本'
			},
			
			clickImage() {
				this.className='smallLoge';
				this.title='点击图标变小'
			},
			
			changeColor() {
				this.num = (this.num+1)%7;
				this.col=this.colorArr[this.num]
			}
		}
	}
</script>

<style>
	.textCenter {
		text-align: center;
	}

	.content {
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
	}

	.logo {
		height: 200rpx;
		width: 200rpx;
		margin-top: 200rpx;
		margin-left: auto;
		margin-right: auto;
		margin-bottom: 50rpx;
	}
	
	.smallLoge {
		height: 50rpx;
		width: 50rpx;
		margin-top: 200rpx;
		margin-left: auto;
		margin-right: auto;
		margin-bottom: 50rpx;
	}

	.text-area {
		display: flex;
		justify-content: center;
	}

	.title {
		font-size: 36rpx;
		color: #8f8f94;
	}
</style>